<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>二维码处理</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link rel="stylesheet" href="/park/bootstrap/css/bootstrap.min.css" >
<link rel="stylesheet" href="/park/bootstrap/css/bootstrap-theme.min.css" >
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="/park/bootstrap/js/bootstrap.min.js" ></script>
<script src="/park/js/layer_mobile/layer.js?v=1.6"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js" ></script>
<script src="/park/js/vue.min.js"></script>
<script src="/park/js/jquery.qrcode.min.js"></script>
<style type="text/css">
.table-striped td,th{
	font-size:18px;
	text-align: center;
}
</style>
</head>
<body>
<div style="width: 96%;margin-left: 2%;margin-top: 30px;" id="dataTable" >
<table class="table table-striped" v-for="item in datas" >
   <tbody>
	   <tr>
			<th>请扫描</th>
<!--			<td v-text="item.orderNo" >20220305121000ZKZJ00201</td>-->

	   </tr>
	   <tr>
		   <td style="padding-top:100px" id="qrcode"></td>
	   </tr>
<!--    <tr>-->
<!--    	<th style="width: 50%;">订单号</th>-->
<!--    	<td v-text="item.orderNo" >20220305121000ZKZJ00201</td>-->
<!--    </tr>-->
<!--     <tr>-->
<!--    	<th>异常类型</th>-->
<!--    	<td>-->
<!--    		<span v-if="'01'==item.abnormalType" v-text="'超时未离场'" ></span>-->
<!--    		<span v-if="'02'==item.abnormalType" v-text="'同车牌在场'" ></span>-->
<!--    		<span v-if="'03'==item.abnormalType" v-text="'车牌未识别'" ></span>-->
<!--    	</td>-->
<!--    </tr>-->
<!--     <tr>-->
<!--    	<th>异常描述</th>-->
<!--    	<td v-text="item.remake">1400</td>-->
<!--    </tr>-->
<!--     <tr>-->
<!--    	<th>入场时间</th>-->
<!--    	<td v-text="item.startTime" >20221230130000</td>-->
<!--    </tr>-->
<!--     <tr>-->
<!--    	<th> <button type="button" style="width: 100%;font-size:18px;line-height: 38px;height: 46px;" v-bind:id="'0_'+item.orderNo+'_'+item.orderStatus" onclick="go(this)" class="btn btn-success">直接离场</button></th>-->
<!--    	<td> <button type="button" style="width: 100%;font-size:18px;line-height: 38px;height: 46px;" v-bind:id="'1_'+item.orderNo+'_'+item.orderStatus" onclick="go(this)" class="btn btn-warning">免费离场</button></td>-->
<!--    </tr>-->
   </tbody>
</table>
</div>
<script type="text/javascript">
$(function(){
	findData();
})
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}
var _d2 ='';
var param = getUrlParam('streetNo');
var loginName = getUrlParam('loginName');
function findData(){
	_parkStatus = 0;
	var plate = $('#plate').val();
	$.ajax({
		url:'/park/data/help/error',
		data:'loginName='+loginName+'&streetNo='+param,
		type:'post',
		dataType:'json',
		success:function(res){
			if('200'==res.code){
				if(res.data.status==0){
					layer.open({
						content: '操作成功，请在有效期内扫码！'
						,skin: 'msg'
						,time: 3 //2秒后自动关闭
					});
					// 生成二维码
					$("#qrcode").qrcode({
						render: "canvas",
						text : utf16to8(res.data.attr.url),
						width : "200",
						height: "200",
						background: "#ffffff",
						foreground: "#000000"
					})
					setTimeout(function () {
						layer.open({
							content: '已超时，请重新生成二维码！'
							,btn: '确定'
							,yes: function () {
								location.href = '/park/helpMain?streetNo='+param+'&loginName='+loginName;
							}
						});
					}, 1000 * 1 * 60);
					// if(_d2==''){
		  			// 	_d2 = new Vue({
		  			// 		el : '#dataTable',
		  			// 		data : {
		  			// 			datas : res.data.attr.result
		  			// 		}
		  			// 	})
		  			// }else{
		  			// 	_d2.datas = res.data.attr.result
		  			// }
					// $('#dataTable').show();
				}else{
					$('#dataTable').hide();
					layer.open({
						content: res.data.msg + '请联系管理员'
						,btn: '确定'
						,yes: function () {
							location.href = '/park/helpMain?streetNo='+param+'&loginName='+loginName;
						}
					  });
				}
			}else{
				$('#dataTable').hide();
				layer.open({
				    content: '出错了！'
				    ,skin: 'msg'
				    ,time: 2 //2秒后自动关闭
				  });
			}
		}
	})
}

function utf16to8(str) {
	var out, i, len, c;
	out = "";
	len = str.length;
	for(i = 0; i < len; i++) {
		c = str.charCodeAt(i);
		if ((c >= 0x0001) && (c <= 0x007F)) {
			out += str.charAt(i);
		} else if (c > 0x07FF) {
			out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
			out += String.fromCharCode(0x80 | ((c >>  6) & 0x3F));
			out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));
		} else {
			out += String.fromCharCode(0xC0 | ((c >>  6) & 0x1F));
			out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));
		}
	}
	return out;
}
// function go(_e){
// 	var id = $(_e).attr('id');
// 	var state = id.split('_')[0];
// 	var orderNo = id.split('_')[1];
// 	var type = id.split('_')[2];
// 	$.ajax({
// 		url:'/park/data/help/leave',
// 		data:'state='+state+'&type='+type+'&orderNo='+orderNo,
// 		type:'post',
// 		dataType:'json',
// 		success:function(res){
// 			if('200'==res.code){
// 				if(res.data.status==0){
// 					layer.open({
// 					    content: '操作成功！'
// 					    ,skin: 'msg'
// 					    ,time: 2 //2秒后自动关闭
// 					  });
// 					location.reload();
// 				}else{
// 					layer.open({
// 					    content: res.data.msg
// 					    ,skin: 'msg'
// 					    ,time: 2 //2秒后自动关闭
// 					  });
// 				}
// 			}else{
// 				layer.open({
// 				    content: '出错了！'
// 				    ,skin: 'msg'
// 				    ,time: 2 //2秒后自动关闭
// 				  });
// 			}
// 		}
// 	})
// }


</script>
</body>
</html>